﻿CREATE PROCEDURE dbo.s_Addresses
	@BorrID int
AS
SET NOCOUNT ON

DECLARE @b int SET @b = 0
WHILE 1=1 BEGIN
	IF (SELECT COUNT(*) FROM t_Address WHERE BorrowerID=@BorrID AND Pos=@b) = 0 BREAK
	SELECT * FROM t_Address WHERE BorrowerID=@BorrID AND Pos=@b
	SET @b = @b + 1
END